package malaria_acd;

import java.io.IOException;

import database.DatabaseAdapter;
import project.malaria.malaria_acd.R;
import util.Generate;
import util.SessionUtil;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {
	private Button addnewep1,syncdata;
	private  DatabaseAdapter db;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		 db = new DatabaseAdapter(this);
		addnewep1 = (Button) findViewById(R.id.addnewep1);
		addnewep1.setOnClickListener(new View.OnClickListener() {
	        public void onClick(View v) {
	        	finish();
	            // Perform action on click
	        	 Intent i = new Intent(MainActivity.this, AddNewActivity.class);
	        	
	        	 try {
	        		 
					db.createDataBase();
					db.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					System.out.println("ERROR:: on creating database");
				}
	        	 startActivityForResult(i,0);	
	        }
	    });
		syncdata = (Button) findViewById(R.id.sync);
		syncdata.setOnClickListener(new View.OnClickListener() {
	        public void onClick(View v) {
	        	finish();
	            // Perform action on click
	        	 Intent i = new Intent(MainActivity.this, SyncActivity.class);
	        	
	        	
	        	 startActivityForResult(i,0);	
	        }
	    });
	}
	
	
	}

	


